# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.BackupDR.V1.Model.Scheduling do
  @moduledoc """
  Sets the scheduling options for an Instance.

  ## Attributes

  *   `automaticRestart` (*type:* `boolean()`, *default:* `nil`) - Optional. Specifies whether the instance should be automatically restarted if it is terminated by Compute Engine (not terminated by a user).
  *   `instanceTerminationAction` (*type:* `String.t`, *default:* `nil`) - Optional. Specifies the termination action for the instance.
  *   `localSsdRecoveryTimeout` (*type:* `GoogleApi.BackupDR.V1.Model.SchedulingDuration.t`, *default:* `nil`) - Optional. Specifies the maximum amount of time a Local Ssd Vm should wait while recovery of the Local Ssd state is attempted. Its value should be in between 0 and 168 hours with hour granularity and the default value being 1 hour.
  *   `minNodeCpus` (*type:* `integer()`, *default:* `nil`) - Optional. The minimum number of virtual CPUs this instance will consume when running on a sole-tenant node.
  *   `nodeAffinities` (*type:* `list(GoogleApi.BackupDR.V1.Model.NodeAffinity.t)`, *default:* `nil`) - Optional. A set of node affinity and anti-affinity configurations. Overrides reservationAffinity.
  *   `onHostMaintenance` (*type:* `String.t`, *default:* `nil`) - Optional. Defines the maintenance behavior for this instance.
  *   `preemptible` (*type:* `boolean()`, *default:* `nil`) - Optional. Defines whether the instance is preemptible.
  *   `provisioningModel` (*type:* `String.t`, *default:* `nil`) - Optional. Specifies the provisioning model of the instance.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :automaticRestart => boolean() | nil,
          :instanceTerminationAction => String.t() | nil,
          :localSsdRecoveryTimeout => GoogleApi.BackupDR.V1.Model.SchedulingDuration.t() | nil,
          :minNodeCpus => integer() | nil,
          :nodeAffinities => list(GoogleApi.BackupDR.V1.Model.NodeAffinity.t()) | nil,
          :onHostMaintenance => String.t() | nil,
          :preemptible => boolean() | nil,
          :provisioningModel => String.t() | nil
        }

  field(:automaticRestart)
  field(:instanceTerminationAction)
  field(:localSsdRecoveryTimeout, as: GoogleApi.BackupDR.V1.Model.SchedulingDuration)
  field(:minNodeCpus)
  field(:nodeAffinities, as: GoogleApi.BackupDR.V1.Model.NodeAffinity, type: :list)
  field(:onHostMaintenance)
  field(:preemptible)
  field(:provisioningModel)
end

defimpl Poison.Decoder, for: GoogleApi.BackupDR.V1.Model.Scheduling do
  def decode(value, options) do
    GoogleApi.BackupDR.V1.Model.Scheduling.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.BackupDR.V1.Model.Scheduling do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
